package network;

import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

public class DictServer extends Server{
    private Map<String, String> dict = new HashMap<>();
    public DictServer(int port) throws SocketException {
        super(port);

        dict.put("cat", "小猫");
        dict.put("dog", "小狗");
        dict.put("fuck", "卧槽");
    }

    @Override
    public String process (String request){
        return dict.getOrDefault(request, "未查找到结果");
    }

    public static void main(String[] args) throws IOException {
        DictServer dictServer = new DictServer(9999);
        dictServer.start();
    }
}
